package com.aiyige.model.resource;

import com.aiyige.model.PlayProgressModel;
import com.aiyige.model.eshop.SellerBackup;
import com.aiyige.model.moment.entity.Moment;
import com.aiyige.utils.ListUtil;

import java.util.List;

/**
 * Created by xiachao on 2018/2/1.
 */

public class UserResource {
    String id;//					id
    String resourceId;//				资源id
    String resourceType;//		是		资源类型
    String resourceName;//		是		资源名称
    String tags;//		是		标签：用逗号分隔开
    String cover;//				封面
    String owner;//		是		资源拥有人ID
    String seller;//				卖家ID
    String status;//				状态
    String router;//				跳转路由
    long createTime;//				保存时间，毫秒
    long updateTime;//				更新时间，毫秒
    SellerBackup sellerBackup;//					卖家信息
    /**
     * 可能存在购买多个moment的情况，所以这里返回list
     */
    List<Moment> resourceBackup;//					资源详情，根据资源类型，组装返回


    List<PlayProgressModel> studyProgressBackup;//上次播放进度



    private boolean showTitle = false;

    private boolean hasMore = false;

    public boolean isSearch() {
        return isSearch;
    }

    public void setSearch(boolean search) {
        isSearch = search;
    }

    private boolean isSearch;


    public List<PlayProgressModel> getStudyProgressBackup() {
        return studyProgressBackup;
    }

    public void setStudyProgressBackup(List<PlayProgressModel> studyProgressBackup) {
        this.studyProgressBackup = studyProgressBackup;
    }


    public boolean isSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }

    boolean isSelected = false;
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getResourceId() {
        return resourceId;
    }

    public void setResourceId(String resourceId) {
        this.resourceId = resourceId;
    }

    public String getResourceType() {
        return resourceType;
    }

    public void setResourceType(String resourceType) {
        this.resourceType = resourceType;
    }

    public String getResourceName() {
        return resourceName;
    }

    public void setResourceName(String resourceName) {
        this.resourceName = resourceName;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public String getCover() {
        return cover;
    }

    public void setCover(String cover) {
        this.cover = cover;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getSeller() {
        return seller;
    }

    public void setSeller(String seller) {
        this.seller = seller;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getRouter() {
        return router;
    }

    public void setRouter(String router) {
        this.router = router;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(long updateTime) {
        this.updateTime = updateTime;
    }

    public SellerBackup getSellerBackup() {
        return sellerBackup;
    }

    public void setSellerBackup(SellerBackup sellerBackup) {
        this.sellerBackup = sellerBackup;
    }

    public List<Moment> getResourceBackup() {
        return resourceBackup;
    }

    public void setResourceBackup(List<Moment> resourceBackup) {
        this.resourceBackup = resourceBackup;
    }

    public Moment getMyBuyMoment() {
        return !ListUtil.isEmpty(getResourceBackup())?getResourceBackup().get(0):null;
    }

    public String getMyBuyMomentSubject() {
        return !ListUtil.isEmpty(getResourceBackup())?getResourceBackup().get(0).getSubject():null;
    }

    public boolean isShowTitle() {
        return showTitle;
    }

    public void setShowTitle(boolean showTitle) {
        this.showTitle = showTitle;
    }

    public boolean isHasMore() {
        return hasMore;
    }

    public void setHasMore(boolean hasMore) {
        this.hasMore = hasMore;
    }

    public String getCityId() {
        if (getMyBuyMoment() != null) {
            return getMyBuyMoment().getCityId();
        }
        return null;
    }
}
